// 部分省市区数据
const placeArray = [{
    "name": "济南",
    "city": [{
        "name": "高新区",
        "area1": ["济南高新学习中心"]
      },
      {
        "name": "历下区",
        "area1": ["济南分校", "山经学习中心"]
      }, {
        "name": "历城区",
        "area1": ["千佛山学习中心"]
      }, {
        "name": "莱芜区",
        "area1": ["莱芜学习中心"]
      }, {
        "name": "长清区",
        "area1": ["长清学习中心"]
      }, {
        "name": "章丘区",
        "area1": ["章丘大学城学习中心"]
      }, {
        "name": "天桥区",
        "area1": ["天桥学习中心"]
      }, {
        "name": "莱芜区",
        "area1": ["莱芜钢城学习中心"]
      }, {
        "name": "济阳区",
        "area1": ["济阳学习中心"]
      }, {
        "name": "平阴县",
        "area1": ["平阴学习中心"]
      }, {
        "name": "商河县",
        "area1": ["商河学习中心"]
      }, {
        "name": "市中区",
        "area1": ["济南大学学习中心"]
      }, {
        "name": "长清区",
        "area1": ["长清县区学习中心"]
      }
    ]
  },
  {
    "name": "滨州",
    "city": [{
      "name": "滨城区",
      "area1": ["滨州分校"]
    }, {
      "name": "邹平市",
      "area1": ["邹平学习中心"]
    }, {
      "name": "惠民县",
      "area1": ["惠民学习中心"]
    }, {
      "name": "博兴县",
      "area1": ["博兴学习中心"]
    }, {
      "name": "无棣县",
      "area1": ["无棣学习中心"]
    }, {
      "name": "阳信县",
      "area1": ["阳信学习中心"]
    }, {
      "name": "沾化区",
      "area1": ["沾化学习中心"]
    }]
  },
  {
    "name": "德州",
    "city": [{
      "name": "德城区",
      "area1": ["德州分校"]
    }, {
      "name": "齐河县",
      "area1": ["齐河学习中心"]
    }, {
      "name": "武城县",
      "area1": ["武城学习中心"]
    }, {
      "name": "禹城市",
      "area1": ["禹城学习中心"]
    }, {
      "name": "临邑县",
      "area1": ["临邑学习中心"]
    }, {
      "name": "陵城区",
      "area1": ["陵城学习中心"]
    }, {
      "name": "平原县",
      "area1": ["平原学习中心"]
    }, {
      "name": "夏津县",
      "area1": ["夏津学习中心"]
    }, {
      "name": "乐陵市",
      "area1": ["乐陵学习中心"]
    }, {
      "name": "宁津县",
      "area1": ["宁津学习中心"]
    }, {
      "name": "庆云县",
      "area1": ["庆云学习中心"]
    }, ]
  },
  {
    "name": "东营",
    "city": [{
        "name": "东城区",
        "area1": ["东营分校"]
      },
      {
        "name": "西城区",
        "area1": ["东营西城学习中心"]
      }, {
        "name": "河口区",
        "area1": ["东营河口学习中心"]
      }, {
        "name": "广饶县",
        "area1": ["东营广饶学习中心"]
      }, {
        "name": "垦利县",
        "area1": ["东营垦利学习中心"]
      }, {
        "name": "利津县",
        "area1": ["东营利津学习中心"]
      },
    ]
  },
  {
    "name": "菏泽",
    "city": [{
        "name": "牡丹区",
        "area1": ["菏泽分校"]
      },
      {
        "name": "曹县",
        "area1": ["菏泽曹县学习中心"]
      }, {
        "name": "东明县",
        "area1": ["菏泽东明学习中心"]
      }, {
        "name": "定陶县",
        "area1": ["菏泽定陶学习中心"]
      }, {
        "name": "郓城县",
        "area1": ["菏泽郓城学习中心"]
      }, {
        "name": "单县",
        "area1": ["菏泽单县学习中心"]
      }, {
        "name": "鄄城县",
        "area1": ["菏泽鄄城学习中心"]
      }, {
        "name": "巨野县",
        "area1": ["菏泽巨野学习中心"]
      }, {
        "name": "成武县",
        "area1": ["菏泽成武学习中心"]
      }, {
        "name": "牡丹区",
        "area1": ["菏泽大学路学习中心"]
      }
    ]
  }, {
    "name": "济宁",
    "city": [{
        "name": "任城区",
        "area1": ["济宁分校"]
      },
      {
        "name": "嘉祥县",
        "area1": ["嘉祥学习中心"]
      }, {
        "name": "金乡县",
        "area1": ["金乡学习中心"]
      }, {
        "name": "邹城市",
        "area1": ["邹城学习中心"]
      }, {
        "name": "兖州区",
        "area1": ["兖州学习中心"]
      }, {
        "name": "汶上县",
        "area1": ["汶上学习中心"]
      }, {
        "name": "梁山县",
        "area1": ["梁山学习中心"]
      }, {
        "name": "曲阜县",
        "area1": ["曲阜学习中心"]
      }, {
        "name": "鱼台县",
        "area1": ["鱼台学习中心"]
      }, {
        "name": "泗水县",
        "area1": ["泗水学习中心"]
      }
    ]
  }, {
    "name": "聊城",
    "city": [{
        "name": "东昌府区",
        "area1": ["聊城分校"]
      },
      {
        "name": "阳谷县",
        "area1": ["阳谷学习中心"]
      }, {
        "name": "茌平区",
        "area1": ["茌平学习中心"]
      }, {
        "name": "临清市",
        "area1": ["临清学习中心"]
      }, {
        "name": "开发区",
        "area1": ["开发区学习中心"]
      }, {
        "name": "冠县",
        "area1": ["冠县学习中心"]
      }, {
        "name": "东阿县",
        "area1": ["东阿学习中心"]
      }, {
        "name": "莘县",
        "area1": ["莘县学习中心"]
      }, {
        "name": "高唐县",
        "area1": ["高唐学习中心"]
      }
    ]
  }, {
    "name": "临沂",
    "city": [{
        "name": "北城新区",
        "area1": ["北城新区学习中心"]
      },
      {
        "name": "兰山区",
        "area1": ["临沂分校"]
      }, {
        "name": "莒南县",
        "area1": ["莒南学习中心"]
      }, {
        "name": "郯城县",
        "area1": ["郯城学习中心"]
      }, {
        "name": "费县",
        "area1": ["费县学习中心"]
      }, {
        "name": "兰陵县",
        "area1": ["兰陵学习中心"]
      }, {
        "name": "沂水县",
        "area1": ["沂水学习中心"]
      }, {
        "name": "蒙阴县",
        "area1": ["蒙阴学习中心"]
      }, {
        "name": "临沭县",
        "area1": ["临沭学习中心"]
      }, {
        "name": "平邑县",
        "area1": ["平邑学习中心"]
      }, {
        "name": "沂南县",
        "area1": ["沂南学习中心"]
      }
    ]
  }, {
    "name": "青岛",
    "city": [{
        "name": "沧口区",
        "area1": ["青岛分校"]
      },
      {
        "name": "开发区",
        "area1": ["开发区学习中心"]
      }, {
        "name": "平度市",
        "area1": ["平度学习中心"]
      }, {
        "name": "胶州市",
        "area1": ["胶州学习中心"]
      }, {
        "name": "城阳区",
        "area1": ["城阳学习中心"]
      }, {
        "name": "即墨区",
        "area1": ["即墨学习中心"]
      }, {
        "name": "莱西市",
        "area1": ["莱西学习中心"]
      }, {
        "name": "崂山区",
        "area1": ["崂山学习中心"]
      }, {
        "name": "胶南市",
        "area1": ["胶南学习中心"]
      }, {
        "name": "李沧区",
        "area1": ["山科学习中心"]
      }, {
        "name": "市北区",
        "area1": ["市北学习中心"]
      }, {
        "name": "市南区",
        "area1": ["市南学习中心"]
      }
    ]
  }, {
    "name": "日照",
    "city": [{
        "name": "东港区",
        "area1": ["日照分校"]
      },
      {
        "name": "莒县",
        "area1": ["莒县学习中心"]
      }, {
        "name": "五莲县",
        "area1": ["五莲学习中心"]
      }, {
        "name": "岚山区",
        "area1": ["岚山学习中心"]
      }
    ]
  }, {
    "name": "泰安",
    "city": [{
        "name": "泰山区",
        "area1": ["泰安分校"]
      },
      {
        "name": "东平县",
        "area1": ["东平学习中心"]
      }, {
        "name": "泰山区",
        "area1": ["农大本部学习中心"]
      }, {
        "name": "泰山区",
        "area1": ["泰山学院学习中心"]
      }, {
        "name": "新泰市",
        "area1": ["新泰学习中心"]
      }, {
        "name": "肥城市",
        "area1": ["肥城学习中心"]
      }, {
        "name": "泰山区",
        "area1": ["科大西校学习中心"]
      }, {
        "name": "泰山区",
        "area1": ["农大南校学习中心"]
      }, {
        "name": "宁阳县",
        "area1": ["宁阳学习中心"]
      }
    ]
  }, {
    "name": "威海",
    "city": [{
        "name": "环翠区",
        "area1": ["威海分校"]
      },
      {
        "name": "文登区",
        "area1": ["文登学习中心"]
      }, {
        "name": "荣成市",
        "area1": ["荣成学习中心"]
      }, {
        "name": "乳山市",
        "area1": ["乳山学习中心"]
      }
    ]
  }, {
    "name": "潍坊",
    "city": [{
        "name": "奎文区",
        "area1": ["潍坊分校"]
      },
      {
        "name": "安丘市",
        "area1": ["安丘学习中心"]
      }, {
        "name": "寿光市",
        "area1": ["寿光学习中心"]
      }, {
        "name": "青州市",
        "area1": ["青州学习中心"]
      }, {
        "name": "高密市",
        "area1": ["高密学习中心"]
      }, {
        "name": "奎文区",
        "area1": ["高新学习中心"]
      }, {
        "name": "诸城市",
        "area1": ["诸城学习中心"]
      }, {
        "name": "昌乐市",
        "area1": ["昌乐学习中心"]
      }, {
        "name": "昌邑市",
        "area1": ["昌邑学习中心"]
      }, {
        "name": "临朐市",
        "area1": ["临朐学习中心"]
      }
    ]
  }, {
    "name": "烟台",
    "city": [{
        "name": "芝罘区",
        "area1": ["烟台分校"]
      },
      {
        "name": "牟平区",
        "area1": ["牟平学习中心"]
      }, {
        "name": "莱山区",
        "area1": ["莱山学习中心"]
      }, {
        "name": "莱州市",
        "area1": ["莱州学习中心"]
      }, {
        "name": "栖霞市",
        "area1": ["栖霞学习中心"]
      }, {
        "name": "招远市",
        "area1": ["招远学习中心"]
      }, {
        "name": "龙口市",
        "area1": ["龙口学习中心"]
      }, {
        "name": "海阳市",
        "area1": ["海阳学习中心"]
      }, {
        "name": "蓬莱区",
        "area1": ["蓬莱学习中心"]
      }, {
        "name": "福山区",
        "area1": ["福山学习中心"]
      }, {
        "name": "莱阳市",
        "area1": ["莱阳学习中心"]
      }
    ]
  }, {
    "name": "枣庄",
    "city": [{
        "name": "市中区",
        "area1": ["枣庄分校"]
      },
      {
        "name": "滕州市",
        "area1": ["滕州学习中心"]
      }, {
        "name": "台儿庄区",
        "area1": ["台儿庄学习中心"]
      }, {
        "name": "峄城区",
        "area1": ["峄城学习中心"]
      }, {
        "name": "微山县",
        "area1": ["微山学习中心"]
      }, {
        "name": "山亭区",
        "area1": ["山亭学习中心"]
      }, {
        "name": "薛城区",
        "area1": ["薛城学习中心"]
      }
    ]
  }, {
    "name": "淄博",
    "city": [{
        "name": "张店区",
        "area1": ["淄博分校"]
      },
      {
        "name": "沂源县",
        "area1": ["沂源学习中心"]
      }, {
        "name": "淄川区",
        "area1": ["淄川学习中心"]
      }, {
        "name": "周村区",
        "area1": ["周村学习中心"]
      }, {
        "name": "博山区",
        "area1": ["博山学习中心"]
      }, {
        "name": "桓台县",
        "area1": ["桓台学习中心"]
      }, {
        "name": "临淄区",
        "area1": ["临淄学习中心"]
      }, {
        "name": "高青县",
        "area1": ["高青学习中心"]
      }
    ]
  }

];

//获取应用实例
var app = getApp()
Page({
  data: {
    awardList: [], //奖品数组
    indexSelect: 0, //被选中的奖品index
    isRunning: false, //是否正在抽奖
    imageAward: [
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
    ], //奖品图片数组
    imageAwarda: [
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
      '../../../images/hz.png',
    ], //奖品图片数组
    jp: '',
    jiang: false,
    inputShow: false,
    boxShow: false,
    placeArray: placeArray,
    province: placeArray[0].name,
    pIndex: 0,
    city: placeArray[0].city[0].name,
    cIndex: 0,
    area1: placeArray[0].city[0].area1[0],
    aIndex: 0

  },
  // 展示弹框
  getbox: function () {
    this.setData({
      boxShow: true
    })
  },
  // 隐藏弹框
  hidebox: function () {
    this.setData({
      boxShow: false
    })
  },
  // 确认按钮
  confirm: function (e) {
    const _ = this;
    _.setData({
      boxShow: false,
      inputShow: true,
      address: _.data.province + _.data.city + _.data.area1
    })
    console.log(_.data.address)
  },
  changeProvince2: function (e) {
    const val = e.detail.value
    this.setData({
      pIndex: val,
      cIndex: 0,
      aIndex: 0,
      province: placeArray[val].name,
      city: placeArray[val].city[0].name,
      area1: placeArray[val].city[0].area1[0]
    })
  },
  changeCity2: function (e) {
    const val = e.detail.value
    this.setData({
      cIndex: val,
      aIndex: 0,
      city: placeArray[this.data.pIndex].city[val].name,
      area1: placeArray[this.data.pIndex].city[val].area1[0]
    })
  },
  changeArea2: function (e) {
    const val = e.detail.value
    this.setData({
      aIndex: val,
      area1: placeArray[this.data.pIndex].city[this.data.cIndex].area1[val]
    })
    console.log(_.data.area1)
  },
  onLoad: function (options) {
    var _ = this;

    wx.request({ //发送请求
      url: 'https://zg99.offcn.com/index/choujiang/getjlinfo?actid=50509&callback=?', //接收url
      data: {
        sstimes: Date.parse(new Date()),
        limits:200
      }, //接收参数
      success(res) {
        var jsonStr = res.data;
        jsonStr = jsonStr.replace("(", "");
        jsonStr = jsonStr.replace(")", "");
        if (typeof jsonStr != 'object') {
          jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
          var theJson = JSON.parse(jsonStr);
        }
        console.log(theJson.lists)
        _.setData({
          zjlists:theJson.lists
        })
      }
    })

    _.setData({
      msgList: [
       { url: "url", title: "公告：多地首套房贷利率上浮 热点城市渐迎零折扣时代" },
       { url: "url", title: "公告：悦如公寓三周年生日趴邀你免费吃喝欢唱" },
       { url: "url", title: "公告：你想和一群有志青年一起过生日嘛？" }]
     });
    if (options.area) {
      wx.setStorageSync('area', options.area)
      wx.setStorageSync('agent', options.agent)
      wx.setStorageSync('page', options.page)
    }

    //奖品item设置
    var awardList = [];
    //间距
    var topAward = 25;
    var leftAward = 30;
    for (var j = 0; j < 8; j++) {
      if (j == 0) {
        topAward = 15;
        leftAward = 15;
      } else if (j < 3) {
        topAward = topAward;
        //180是宽.15是间距.下同
        leftAward = leftAward + 168 + 12;
      } else if (j < 5) {
        leftAward = leftAward;
        //186是高,15是间距,下同
        topAward = topAward + 170 + 15;
      } else if (j < 7) {
        leftAward = leftAward - 168 - 12;
        topAward = topAward;
      } else if (j < 8) {
        leftAward = leftAward;
        topAward = topAward - 170 - 15;
      }
      var imageAward = this.data.imageAward[j];
      awardList.push({
        topAward: topAward,
        leftAward: leftAward,
        imageAward: imageAward
      });
    }
    this.setData({
      awardList: awardList
    })
  },
  submit() {
    var _ = this;
    var phone = wx.getStorageSync('kxjphone')

    if (phone) {
      wx.request({ //发送请求
        url: 'https://zg99.offcn.com/index/choujiang/getcjusers?actid=50509&callback=?', //接收url
        data: {
          phone: phone,
          sstimes: Date.parse(new Date()),
          limits: 100
        }, //接收参数
        success(res) {
          var jsonStr = res.data;
          jsonStr = jsonStr.replace("(", "");
          jsonStr = jsonStr.replace(")", "");
          if (typeof jsonStr != 'object') {
            jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
            var theJson = JSON.parse(jsonStr);
          }
          console.log(theJson)
          if (theJson.status == 2) {
            _.startGame()
          } else if (theJson.lists.length < 2) {
            let kxjShare = wx.getStorageSync('kxjShare')
            if (kxjShare) {
              _.startGame()
            } else {
              wx.showToast({
                title: '请先转发页面！',
                icon: 'error'
              })
              _.setData({
                isRunning: false,
              })
            }
          } else {
            wx.showModal({
              title: '次数不足',
              content: '您已经抽过两次奖了！',
              showCancel: false, //去掉取消按钮
              success: function (res) {
                if (res.confirm) {
                  _.setData({
                    isRunning: false,
                  })
                  _.xx()
                }
              }
            })
          }
        }
      })
     
    } else {
      wx.showToast({
        title: '请先登录',
        duration: 2000,
        icon: 'none'
      })
      wx.navigateTo({
        url: '../login/login',
      })
    }
  },

  //开始抽奖
  startGame: function () {
    if (this.data.isRunning) return
    this.setData({
      isRunning: true
    })
    var _ = this;
    var indexSelect = 0
    var i = 0;
    var timer = setInterval(function () {
      indexSelect++;
      var random = Math.random() * 100; //转盘
      // console.log(random)
      i += random;
      if (i > 1000) {
        //去除循环
        clearInterval(timer)
        //获奖提示
        var phone = wx.getStorageSync('kxjphone')
        wx.request({ //发送请求
          url: 'https://zg99.offcn.com/index/choujiang/getcjusers?actid=50509&callback=?', //接收url
          data: {
            phone: phone,
            sstimes: Date.parse(new Date()),
            limits: 100
          }, //接收参数
          success(res) {
            var jsonStr = res.data;
            jsonStr = jsonStr.replace("(", "");
            jsonStr = jsonStr.replace(")", "");
            if (typeof jsonStr != 'object') {
              jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
              var theJson = JSON.parse(jsonStr);
            }
            console.log(theJson)
            if (theJson.status == 2) {
              wx.request({ //发送请求
                url: 'https://zg99.offcn.com/index/choujiang/lottery?actid=50509&callback=?', //接收url
                data: {
                  phone: phone,
                  sstimes: Date.parse(new Date()),
                  isagree: true
                }, //接收参数
                success(res) {
                  var jsonStr = res.data;
                  jsonStr = jsonStr.replace("(", "");
                  jsonStr = jsonStr.replace(")", "");
                  if (typeof jsonStr != 'object') {
                    jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
                    var theJson = JSON.parse(jsonStr);
                  }
                  console.log(theJson)
                  if(theJson.prizeid == 5){
                    wx.setStorageSync('swdt', '1')
                  }
                  _.setData({
                    jp: theJson.prizename,
                    jiang: true,
                    isRunning: false,
                    gz: !1,
                    ewm: !1,
                    zj: 1,
                    xx: !1,
                    jpxx:!1
                  })
                }
              })
            } else if (theJson.lists.length < 2) {
              let kxjShare = wx.getStorageSync('kxjShare')
              if (kxjShare) {
                wx.request({ //发送请求
                  url: 'https://zg99.offcn.com/index/choujiang/lottery?actid=50509&callback=?', //接收url
                  data: {
                    phone: phone,
                    sstimes: Date.parse(new Date()),
                    isagree: true
                  }, //接收参数
                  success(res) {
                    var jsonStr = res.data;
                    jsonStr = jsonStr.replace("(", "");
                    jsonStr = jsonStr.replace(")", "");
                    if (typeof jsonStr != 'object') {
                      jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
                      var theJson = JSON.parse(jsonStr);
                    }
                    console.log(theJson)
                    if(theJson.prizeid == 5){
                      wx.setStorageSync('swdt', '1')
                    }
                    _.setData({
                      jp: theJson.prizename,
                      jiang: true,
                      isRunning: false,
                      gz: !1,
                      ewm: !1,
                      zj: 1,
                      xx: !1,
                      jpxx:!1
                    })
                  }
                })
              } else {
                wx.showToast({
                  title: '请先转发页面！',
                  icon: 'error'
                })
                _.setData({
                  isRunning: false,
                })
              }
            } else {
              wx.showModal({
                title: '次数不足',
                content: '您已经抽过两次奖了！',
                showCancel: false, //去掉取消按钮
                success: function (res) {
                  if (res.confirm) {
                    _.setData({
                      isRunning: false,
                    })
                    _.xx()
                  }
                }
              })
            }
          }
        })
      }
      indexSelect = indexSelect % 8;
      _.setData({
        indexSelect: indexSelect
      })
    }, (200 + i))
  },
  nameInput: function (e) {
    this.setData({
      name: e.detail.value
    })
    console.log(this.data.name)
  },
  schoolInput: function (e) {
    this.setData({
      school: e.detail.value
    })
    console.log(this.data.school)
  },
  addressInput: function (e) {
    this.setData({
      address: e.detail.value
    })
    console.log(this.data.address)
  },
  telInput: function (e) {
    this.setData({
      tel: e.detail.value
    })
    console.log(this.data.tel)
  },
  jpxx() {
    const _ = this;
    _.setData({
      jpxx:1,
      gz: !1,
      ewm:!1,
      zj: !1,
      xx: !1
    })
  },
  ewm() {
    const _ = this;
    _.setData({
      gz: !1,
      ewm: 1,
      zj: !1,
      xx: !1,
      jpxx:!1
    })
  },
  close() {
    const _ = this;
    _.setData({
      gz: !1,
      jpxx:!1,
      ewm: !1,
      zj: !1,
      sr: !1,
      xx: !1
    })
  },

  gz() {
    const _ = this;
    _.setData({
      gz: 1,
      jpxx:!1,
      zj: !1,
      xx: !1
    })
  },
  xx() {
    const _ = this;
    let phone = wx.getStorageSync('kxjphone')
    wx.request({ //发送请求
      url: 'https://zg99.offcn.com/index/choujiang/getcjusers?actid=50509&callback=?', //接收url
      data: {
        phone: phone,
        sstimes: Date.parse(new Date()),
        isagree: true
      }, //接收参数
      success(res) {
        var jsonStr = res.data;
        jsonStr = jsonStr.replace("(", "");
        jsonStr = jsonStr.replace(")", "");
        if (typeof jsonStr != 'object') {
          jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
          var theJson = JSON.parse(jsonStr);
        }
        console.log(theJson.lists)
        _.setData({
          jplist: theJson.lists
        })
      }
    })
    _.setData({
      gz: !1,
      zj: !1,
      xx: 1
    })
  },
  qdxx() {
    const _ = this;
    let phone = wx.getStorageSync('kxjphone')
    wx.request({ //发送请求
      url: 'https://zg99.offcn.com/index/choujiang/updateuser?actid=50509&callback=?', //接收url
      data: {
        phone: phone,
        sstimes: Date.parse(new Date()),
        isagree: true,
        name: _.data.name,
        school: _.data.school,
        tel: _.data.tel
      }, //接收参数
      success(res) {
        var jsonStr = res.data;
        jsonStr = jsonStr.replace("(", "");
        jsonStr = jsonStr.replace(")", "");
        if (typeof jsonStr != 'object') {
          jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
          var theJson = JSON.parse(jsonStr);
        }
        console.log(theJson)
        let swdt =  wx.getStorageSync('swdt')
        if(swdt == 1){
          _.setData({
            gz: !1,
            zj: !1,
            xx: !1,
            swdt:1
          })
        } else {
          _.setData({
            gz: !1,
            zj: !1,
            xx: !1
          })
          wx.showToast({
            title: '提交成功！',
          })
        }
       
      }
    })
  },
  swdt(){
    wx.showLoading({
      title: '下载中...',
    })
    wx.downloadFile({
      // 示例 url，并非真实存在
      url: 'https://sd.offcn.com/zg/wximg/2022/xd/kxjcj/swdt.pdf',
      success: function (res) {
        console.log(res)
        const filePath = res.tempFilePath;
        const fs = wx.getFileSystemManager(); //拿到小程序整个文件系统
        wx.openDocument({
          filePath: filePath,
          success: function (res) {
            console.log('打开文档成功')
            wx.hideLoading({
              success: (res) => {},
            })
          },
          fail(res) {
            console.log(res)
          }
        })


      },
      fail(res) {
        console.log(res)
      }
    })
  },
  onShareAppMessage() {
    const _ = this;
    setTimeout(function(){
      _.setData({
        sr:1,
        gz: !1,
        jpxx:!1,
        ewm: !1,
        zj: !1,
        xx: !1
      })
    },3000)
    wx.setStorageSync('kxjShare', '1')
    let area = wx.getStorageSync('area')
    let agent = wx.getStorageSync('agent')
    let page = wx.getStorageSync('page')
    return {
      title: '新学期，‘抽’出好运气',
      path: '/pages/kxjcj/login/login?area=' + area + '&agent=' + agent + '&page=' + page // 路径，传递参数到指定页面。
    }
  },
})